/*******************************************************************************
*  file    : transformparamsprivate.cpp
*  created : 04.07.2014
*  author  : Slyshyk Oleksiy (alexSlyshyk@gmail.com)
*******************************************************************************/

#include "transformparamsprivate.hpp"
#include <QDebug>

namespace plugin_utils {

TransformParamsPrivate::TransformParamsPrivate()
{
}

void TransformParamsPrivate::setParams(const QVariant &params)
{
    if(params.type() != QVariant::Map)
        {
            qWarning() << "We expect Map but receive " << params.typeName();
            return;
        }

    QVariantMap map = params.toMap();

    if(map.keys().contains("norm"))
        normalization_ = map["norm"].toDouble();

    if(map.keys().contains("smooth"))
        {
            smooth_ = map["smooth"].toString();
        }

    if(map.keys().contains("samplerate"))
        {
            sampleRate_ = map["samplerate"].toInt();
        }

    zoneBegin_ = map["zone_begin"].toDouble();
    zoneEnd_   = map["zone_end"  ].toDouble();

    prev_time_ = map["prev_time"].toDouble();

    fx_offset_ = map["fx_offset"].toDouble();

    patternFileName_ = QStringLiteral("./data/") + map["pattern_file"].toString();
}
double TransformParamsPrivate::normalization() const
{
    return normalization_;
}

void TransformParamsPrivate::setNormalization(double normalization)
{
    normalization_ = normalization;
}

double TransformParamsPrivate::freqCoef() const
{
    return sampleRate_;
}

void TransformParamsPrivate::setSampleRate(double sampleRate)
{
    sampleRate_ = sampleRate;
}
QString TransformParamsPrivate::smooth() const
{
    return smooth_;
}

void TransformParamsPrivate::setSmooth(const QString &smooth)
{
    smooth_ = smooth;
}
double TransformParamsPrivate::zoneEnd() const
{
    return zoneEnd_;
}

void TransformParamsPrivate::setZoneEnd(double zoneEnd)
{
    zoneEnd_ = zoneEnd;
}
QString TransformParamsPrivate::patternFileName() const
{
    return patternFileName_;
}

void TransformParamsPrivate::setPatternFileName(const QString &patternFileName)
{
    patternFileName_ = patternFileName;
}
int TransformParamsPrivate::minIdx() const
{
    return minIdx_;
}

void TransformParamsPrivate::setMinIdx(int minIdx)
{
    minIdx_ = minIdx;
}
int TransformParamsPrivate::maxIdx() const
{
    return maxIdx_;
}

void TransformParamsPrivate::setMaxIdx(int maxIdx)
{
    maxIdx_ = maxIdx;
}
double TransformParamsPrivate::fxOffset() const
{
    return fx_offset_;
}

void TransformParamsPrivate::setFxOffset(double fx_offset)
{
    fx_offset_ = fx_offset;
}
double TransformParamsPrivate::prevTime() const
{
    return prev_time_;
}

void TransformParamsPrivate::setPrevTime(double prev_time)
{
    prev_time_ = prev_time;
}

double TransformParamsPrivate::zoneBegin() const
{
    return zoneBegin_;
}

void TransformParamsPrivate::setZoneBegin(double zoneBegin)
{
    zoneBegin_ = zoneBegin;
}


}



